package com.elasicsearch.controller;

import com.elasicsearch.service.GoodsSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by
 *
 * @author touni
 * @date 2019/4/28
 * @time 11:23
 */
@RestController
@RequestMapping("search")
public class GoodsSearchController {


    @Autowired
    private GoodsSearchService goodsSearchService;


    /**
     * 将商品导入到索引库中
     * @return
     */
    @RequestMapping("add/goods")
    public ResponseEntity addGoods(){
        return goodsSearchService.addGoods();

    }

    @RequestMapping("goods/{key}")
    public ResponseEntity searchGoods(@PathVariable String key){

        return goodsSearchService.searchGoods(key);


    }



















}
